import { ColumnProps } from '~/library/components/ProTable/interface'
import { Promotion } from '~/src/api/interface/retail'
import { getLastQuarterDays } from '~/src/utils/date'
import { formatDate } from '~/src/utils/date-formatter'
import { statusList, warehouseStatus } from '~/src/utils/serviceDict'

export const SteepDescentColumn: ColumnProps<Promotion.DiscountLimit[]>[] = [
  {
    type: 'index',
    label: '序号',
    search: {
      el: 'date-picker',
      label: '单据日期',
      key: 'timeValue',
      order: 1,
      defaultValue: [formatDate(-getLastQuarterDays(), 'start', 'yyyy-MM-dd'), formatDate(0, 'end', 'yyyy-MM-dd')],
      props: {
        type: 'datetimerange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
      },
    },
    width: 60,
  },
  { sortable: true, prop: 'activityInfoName', label: '活动名称', minWidth: 200, search: { el: 'input' } },
  // { sortable: true, prop: 'activityInfoId', label: '单据编号', minWidth: 200, search: { el: 'input' } },
  {
    sortable: true,
    prop: 'checkFlagName',
    label: '审核状态',
    minWidth: 120,
    isFilterEnum: false,
    enum: warehouseStatus,
    search: { el: 'select', key: 'checkFlag' },
  },
  {
    sortable: true,
    prop: 'channelName',
    label: '适用渠道',
    minWidth: 120,
  },
  {
    sortable: true,
    prop: 'statusName',
    label: '状态',
    minWidth: 120,
    enum: statusList,
    isFilterEnum: false,
    search: { el: 'select', key: 'status' },
  },
  {
    sortable: true,
    prop: 'activityBeginDate',
    label: '活动有效期',
    minWidth: 300,
  },
  {
    sortable: true,
    prop: 'createTime',
    label: '创建时间',
    minWidth: 150,
  },
  { prop: 'operation', label: '操作', width: 180, fixed: 'right' },
]

export const storeColumn: ColumnProps<any>[] = [
  { type: 'selection', width: 80 },
  { prop: 'storeName', label: '门店名称', minWidth: 180, align: 'left' },
  {
    prop: 'address',
    label: '地址',
    minWidth: 120,
    align: 'left',
  },
  { prop: 'createTime', label: '创建日期', minWidth: 120, align: 'left' },
]
export const categoryColumn: ColumnProps<any>[] = [
  { type: 'selection', width: 80 },
  {
    sortable: true,
    prop: 'name',
    label: '分类名称',
    align: 'left',
  },
  {
    sortable: true,
    prop: 'isShow',
    label: '是否显示',
    width: 120,
  },
  {
    sortable: true,
    prop: 'createTime',
    label: '创建日期',
    width: 250,
  },
]
